# @Version        : 1.0
# @Update Time    : 2024/12/8 15:54
# @File           : resource_schema.py
# @IDE            : PyCharm
# @Desc           : 文件描述信息
from pydantic import Field
from fastapi_utils.api_model import APIModel
from src.schemas.base_schema import MixinSchema
from fastapi import Depends, Query
from src.core.dependencies import QueryParams, Paging
from src.core.query_builder import FilterCriteria, QueryType


class ResourceParams(QueryParams):
    def __init__(
        self,
        filename: str = Query(None, description="文件名"),
        params: Paging = Depends(Paging),
    ):
        super().__init__(params)
        self.filename = FilterCriteria(QueryType.LIKE, filename)


class ResourceSchema(APIModel):
    """
    资源管理
    """

    filename: str = Field(..., description="文件名")
    url: str = Field(..., description="文件地址")
    file_type: str = Field(..., description="文件类型")


class ResourceOut(ResourceSchema, MixinSchema):
    pass
